import {defineStore} from 'pinia'
import api from '@/api'
interface IShopcartItem{
    _id:string,
    name:string,
    price:number,
    num:number
}   
interface IShopcart{
    rows:Array<IShopcartItem>
}
const useShopcartStore=defineStore('shopcart',{
    state:():IShopcart=>{
        return{
            rows:[]
        }
    },
    actions:{
        async getShopcartListAsync(){
           const result=await api.shopcart.getShopcartList()
           console.log('购物车信息',result.data.data);
           this.rows=result.data.data
        }
    }
})
export default useShopcartStore